<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTableComments extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('comments', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('user_id')->nullable()->comment('评论人ID');
            $table->bigInteger('post_id')->nullable()->comment('文章ID');
            $table->bigInteger('comment_id')->nullable()->comment('父评论ID');
            $table->text('content')->nullable()->comment('内容');
            $table->bigInteger('star_count')->nullable()->comment('点赞数');
            $table->bigInteger('comment_count')->nullable()->comment('子评论数');
            $table->tinyInteger('status')->default(1)->comment('状态');
            $table->char('active', 1)->default('1')->comment('是否激活');
            $table->boolean('is_delete')->default(0)->comment('是否删除');
            $table->timestamp('create_time')->nullable();
            $table->timestamp('update_time')->nullable();
            $table->timestamp('delete_time')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('comments');
    }
}
